<?php require_once('header.php'); ?>
<?php //include_once('topwidget.php'); ?>

<div id="contentBox">
<?php include_once('sidebar.php'); ?>

<!--- query for signup an user to the site -->
<?php
if(isset($_POST['Signup'])) {
	$fullname = $_POST['fullname'];
	$username = $_POST['username'];
	$passkey = md5($_POST['passkey']);
	$experties = $_POST['experties'];
	$company = $_POST['company'];
	$address = $_POST['address'];
	$state = $_POST['state'];
	$postal = $_POST['postal'];
	$country = $_POST['country'];
	$email = $_POST['email'];
	$phone = $_POST['phone'];
	$skype = $_POST['skype'];
	$yahoo = $_POST['yahoo'];
	$skills = $_POST['skills'];
	$description = $_POST['description'];
	//$joindate = $_POST['joindate'];
	$typeid = $_POST['typeid'];

	$signup = "INSERT INTO users ( fullname, username, passkey, experties, company, address, state, postal, country, email, phone, skype, yahoo, skills, description, joindate, typeid )
	VALUES ('$fullname', '$username', '$passkey', '$experties', '$company', '$address', '$state', '$postal', '$country', '$email', '$phone', '$skype', '$yahoo', '$skills', '$description', NOW(), '$typeid')";
	connection();
	
	if(mysql_query($signup)) {
		success();
	} else {
		failed();
	}
}
?>

<div id="content">
    <div class="form">
    <fieldset>
    	<legend><h1>Post a new projects</h1></legend>
        <form action="signup.php" method="post">
            <div class="inputArea">
                <label for="input">I would like to be</label>
                <input type="radio" name="typeid" value="2" id="client" />Client
                <input type="radio" name="typeid" value="3" id="contractor" />Contractor
            </div>        
            <div class="inputArea">
                <label for="input">Full name</label>
                <input type="text" name="fullname" />
            </div>
            <div class="inputArea">
                <label for="input">Username</label>
                <input type="text" name="username" />
            </div>
            <div class="inputArea">
                <label for="input">Password</label>
                <input type="password" name="passkey" />
            </div>
            <div class="inputArea">
                <label for="input">Experties</label>
                <input type="text" name="experties" />
            </div>
            <div class="inputArea">
                <label for="input">Company</label>
                <input type="text" name="company" />
            </div>
            <div class="inputArea">
                <label for="input">Address</label>
                <input type="text" name="address" />
            </div>
            <div class="inputArea">
                <label for="input">State</label>
                <input type="text" name="state" />
            </div>
            <div class="inputArea">
                <label for="input">Postal</label>
                <input type="text" name="postal" />
            </div>
            <div class="inputArea">
                <label for="input">Country</label>
                <?php
				$countryquery = "SELECT * FROM countries";
				connection();
				$countries = mysql_query($countryquery);
				?>
                <select name="country">
                <?php while($country = mysql_fetch_assoc($countries)) { ?>
                	<option value="<?php echo $country['country']; ?>"><?php echo $country['country']; ?></option>
                <?php } ?>
                </select>
                
            </div>
            <div class="inputArea">
                <label for="input">Email</label>
                <input type="text" name="email" />
            </div>
            <div class="inputArea">
                <label for="input">Phone</label>
                <input type="text" name="phone" />
            </div>
            <div class="inputArea">
                <label for="input">Skype</label>
                <input type="text" name="skype" />
            </div>
            <div class="inputArea">
                <label for="input">Yahoo</label>
                <input type="text" name="yahoo" />
            </div>
            <div class="inputArea">
                <label for="input">Skills</label>
                <input type="text" name="skills" />
            </div>
            <div class="inputArea">
                <label for="input">Describe about you</label>
                <textarea name="description" rows="6"></textarea>
            </div>            
			<input type="hidden" name="joindate" value="<?php echo date("F j, Y, g:i a"); ?>" />
            <div class="inputArea">
            	<label for="input">&nbsp;</label>
                <input class="oBtn inneroBtnPrimary" type="submit" name="Signup" value="Signup" />
            </div>
        </form>
        </fieldset>
</div>
<!-- end content in bottom div -->
</div>
<div style="clear:both;"></div>

<?php //include_once('bottomwidget.php'); ?>
<?php include_once('footer.php'); ?>